Skip to content

Update version ordering for packages - #1613

Closed
Rishi-source wants to merge 3 commits into
aboutcode-org:mainfrom
Rishi-source:package-version-handling
Closed

Rishi-source wants to merge 3 commits into
aboutcode-org:mainfrom
Rishi-source:package-version-handling

Conversation

@Rishi-source

@Rishi-source Rishi-source commented Oct 13, 2024

Copy link
Copy Markdown

Issue: #1549

Hey everyone, this pull request brings a few key improvements to how we handle package versions. Here’s what’s new:

Version Handling Improvements:

introduced a new Version Handler class to make version parsing much more reliable and standardized. It now covers:

Date-based versions like YYYY-MM-DD.
Versions that have underscores (e.g., 1.2.3_4).
Versions with build metadata like 1.2.3-alpha.
Even Git commit hashes (those long 40-character strings).

This will help us ensure package versions are consistently and accurately ordered.

Batch Processing:

We’ve added batch processing for updating packages, with a default batch size of 1,000. This means we can process larger datasets without slowing things down.
The command goes through each package batch-by-batch and updates the version_order and is_pre_release fields to maintain consistency.

Error Handling:

Improved the error handling for invalid version strings. We’re now better at logging and identifying problematic versions, which should make debugging easier.

Pre-Release Flag Identification:

We’ve also improved how we identify pre-release versions, so it’s clearer which versions are stable and which are still in the pre-release phase.

How to Run:

  1. You can first Run command python manage.py update_packages so that it can create a version order for all the existing entries.
  2. Then you can Clearly see that now the packages is sorted on the basis of the version.If you add a new version entry for a same package then it would adjust the version order in some float value accordingly.

@Rishi-source
Rishi-source marked this pull request as draft October 15, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants